package com.wms.function.service.impl;

import java.util.List;
        import com.wms.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wms.function.mapper.TbSupplierMapper;
import com.wms.function.domain.TbSupplier;
import com.wms.function.service.ITbSupplierService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;

/**
 * 供应商Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-26
 */
@Service
public class TbSupplierServiceImpl extends ServiceImpl<TbSupplierMapper,TbSupplier> implements ITbSupplierService {
    @Autowired
    private TbSupplierMapper tbSupplierMapper;

    /**
     * 查询供应商
     *
     * @param id 供应商主键
     * @return 供应商
     */
    @Override
    public TbSupplier selectTbSupplierById(Long id) {
                return getById(id);
    }

    /**
     * 查询供应商列表
     *
     * @param tbSupplier 供应商
     * @return 供应商
     */
    @Override
    public List<TbSupplier> selectTbSupplierList(TbSupplier tbSupplier) {
        return tbSupplierMapper.selectTbSupplierList(tbSupplier);
    }

    /**
     * 新增供应商
     *
     * @param tbSupplier 供应商
     * @return 结果
     */
    @Override
    public int insertTbSupplier(TbSupplier tbSupplier) {
                                                                return save(tbSupplier) ? 1 : 0;
    }

    /**
     * 修改供应商
     *
     * @param tbSupplier 供应商
     * @return 结果
     */
    @Override
    public int updateTbSupplier(TbSupplier tbSupplier) {
                                                        return updateById(tbSupplier) ? 1 : 0;
    }

    /**
     * 批量删除供应商
     *
     * @param ids 需要删除的供应商主键
     * @return 结果
     */
    @Override
    public int deleteTbSupplierByIds(Long[] ids) {
                return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除供应商信息
     *
     * @param id 供应商主键
     * @return 结果
     */
    @Override
    public int deleteTbSupplierById(Long id) {
                return removeById(id) ? 1 : 0;
    }

}
